/* Janus Chat - Version 1.0
 * Authors: Matthew Perry
 *          Michael Freid
 *          Marc Latou
 *          Richard Lee
 *
 * The Janus Chat Client is a highly secured
 * peer-to-peer chat client designed to facilitate
 * the transfer of sensitive data or as a communication
 * medium for the extra paranoid
 *
 * This file contains the headers for a Unix Server Socket Class
 * wrapper. This will facilitate the production of janus'
 * functions. */

#ifndef SERVSOCKET_H
#define SERVSOCKET_H

#include "socket.h"
#include <string>
#include <string.h>
#include <sys/time.h>

//Socket libraries
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<netdb.h>

using std::string;

class ServerSocket
{
    private:
      struct sockaddr_in me;    /* Information struct about the user */
      struct sockaddr_in peer;  /* Information struct about the peer */
      int listenPort;           /* The port that this class is listening one */
      int listenFD;             /* This file descriptor that this class is using */

    public:
      ServerSocket();
      ~ServerSocket() {}

      Socket acceptSocket();
      Socket acceptSocket( struct timeval timeout );

      void findAndBind();

      int getPort() { return listenPort; }
};

#endif
